import {request} from "./request";

// 用户登录
function userLogin(student_id, password) {
  return request('http://127.0.0.1:3007/api/login', 'post',{student_id, password},1)
}
//注册用户
function user(student_id, user_name, id_card, professional) {
  return request('http://127.0.0.1:3007/api/reguser', 'post',{student_id, user_name, id_card, professional},1)
}
//删除用户
function deleteuser(user_id) {
  return request('http://127.0.0.1:3007/my/deleteUser', 'post', {user_id}, 1)
}
//修改密码
function changepassword(oldPwd, newPwd) {
  return request('http://127.0.0.1:3007/my/updatepwd', 'post', {oldPwd, newPwd}, 1)
}
//忘记密码
function forgetpassword(student_id, user_name, id_card, newPwd) {
  return request('http://127.0.0.1:3007/api/forgetPassword', 'post', {student_id, user_name, id_card, newPwd}, 1)
}
//更改用户信息
function changeuser(nickname, head_img, signature, sex, address, phone, qq) {
  return request('http://127.0.0.1:3007/my/changeUserInfo', 'post', {nickname, head_img, signature, sex, address, phone, qq}, 1)
}
//管理用户信息
function adminuser(user_id,type) {
  return request('http://127.0.0.1:3007/api/chengeType', 'post', {user_id,type}, 1)
}
//查看用户信息
function getuser() {
  return request('http://127.0.0.1:3007/my/userinfo', 'get','',1)
}
//获取老乡
function gethome(address,n) {
  return request('http://127.0.0.1:3007/my/adressFind', 'post', {address, pageSize:10, pageNum:n}, 1)
}
//获取用户列表
function getuserlist(n) {
  return request('http://127.0.0.1:3007/my/userFind', 'post', {pageSize:10,pageNum:n}, 1)
}
//获取全部文章
function getarticle(n) {
  return request('http://127.0.0.1:3007/api/article/details', 'post', {pageSize:10,pageNum:n}, 1)
}
//添加文章
function addarticle(content) {
  return request('http://127.0.0.1:3007/my/article/add', 'post', {content}, 1)
}
function addarticle1(content, picture) {
  return request('http://127.0.0.1:3007/my/article/add', 'post', {content, picture}, 1)
}
//删除文章
function deletearticle(acticle_id) {
  return request('http://127.0.0.1:3007/my/article/deleteUserdetails', 'post', {acticle_id}, 1)
}
//获取全部点赞
function getzan(article_id) {
  return request(`http://127.0.0.1:3007/my/zan/userInfo/${article_id}`, 'get', '', 1)
}
//点赞
function addzan(article_id) {
  return request(`http://127.0.0.1:3007/my/zan/giveLike/${article_id}`, 'get', '', 1)
}
//取消点赞
function deletezan(article_id) {
  return request(`http://127.0.0.1:3007/my/zan/deleteLike/${article_id}`, 'get', '', 1)
}
//获取文章评论
function getcomments(acticle_id) {
  return request('http://127.0.0.1:3007/api/comments/commentsCates', 'post', {acticle_id}, 1)
}
//添加文章评论
function addcomments(acticle_id, user_id, comments_content) {
  return request('http://127.0.0.1:3007/my/comments/addComments', 'post', {acticle_id, user_id, comments_content}, 1)
}
//删除文章评论
function deletecomments(comments_id) {
  return request('http://127.0.0.1:3007/api/comments/deleteComments', 'post', {comments_id}, 1)
}
//获取评论回复
function getreply(comments_id) {
  return request('http://127.0.0.1:3007/api/comments/replyCates', 'post', {comments_id}, 1)
}
//添加评论回复
function addreply(comments_id, reply_content) {
  return request('http://127.0.0.1:3007/my/comments/addReply', 'post', {comments_id, reply_content}, 1)
}
//删除评论回复
function deletereply(reply_id) {
  return request('http://127.0.0.1:3007/api/comments/deleteReply', 'post', {reply_id}, 1)
}
//添加阅读量
function addreading(acticle_id) {
  return request(`http://127.0.0.1:3007/my/article/read/${acticle_id}`, 'get', {}, 1)
}
//获取用户的文章
function getuserarticle(n) {
  return request(`http://127.0.0.1:3007/my/article/userdetails`, 'post', {pageSize:10,pageNum:n}, 1)
}
//获取全部活动
function getallactivity(n) {
  return request('http://127.0.0.1:3007/api/activity/activityCates', 'post', {pageSize:10,pageNum:n}, 1)
}
//参加活动
function joinactivity(activity_id, name, phone, professional, sign_up_people) {
  return request('http://127.0.0.1:3007/my/activity/addsignUp', 'post', {activity_id, name, phone, professional, sign_up_people}, 1)
}
//获取用户参加的活动
function getuseractivity(n) {
  return request('http://127.0.0.1:3007/my/activity/signUpUser', 'post', {pageSize:10,pageNum:n}, 1)
}
//根据活动id获取活动
function getactivity(activity_id) {
  return request('http://127.0.0.1:3007/my/activity/activityCorresponding', 'post', {activity_id}, 1)
}
//根据活动id和审核状态获取审核表
function getaudit(activity_id, audit, n) {
  return request('http://127.0.0.1:3007/my/activity/signUpCates', 'post', {activity_id, audit, pageSize:10, pageNum:n}, 1)
}
//审核
function adminaudit(sign_up_id, activity_id, audit, sign_up_people) {
  return request('http://127.0.0.1:3007/my/activity/signUpAudit', 'post', {sign_up_id, activity_id, audit, sign_up_people}, 1)
}
//获取专业活动
function activityCatesProfessional(professional,n) {
  return request('http://127.0.0.1:3007/api/activity/activityCatesProfessional', 'post', {professional, pageSize:10, pageNum:n}, 1)
}
//修改活动
function changeactivity(activity_id, people, title, content, type, sign_up_end_time, end_time, note, professional) {
  return request('http://127.0.0.1:3007/api/activity/activityModify', 'post', {activity_id, people, title, content, type, sign_up_end_time, end_time, note, professional}, 1)
}
//删除活动
function deleteactivity(activity_id) {
  return request('http://127.0.0.1:3007/api/activity/deleteActivity', 'post', {activity_id}, 1)
}
//添加活动
function addactivity(people, title, content, professional, type, sign_up_end_time, end_time, note) {
  return request('http://127.0.0.1:3007/api/activity/addActivity', 'post', {people, title, content, professional, type, sign_up_end_time, end_time, note}, 1)
}
//查看别人信息
function getothersuser(user_id) {
  return request('http://127.0.0.1:3007/api/article/userinfoOther', 'post', {user_id}, 1)
}
//留言
function liuyanuser(source_id, chat_content ) {
  return request('http://127.0.0.1:3007/my/chat/addChat', 'post', {source_id, chat_content}, 1)
}
//查看留言
function getliuyan(source_id) {
  return request('http://127.0.0.1:3007/my/chat/chatCates', 'post', {source_id}, 1)
}
//查看别人发表的文章
function getotheractivity(user_id,n) {
  return request('http://127.0.0.1:3007/api/article/userOtherdetails', 'post', {user_id, pageSize:10, pageNum:n}, 1)
}
//获取留言人的列表
function getliuyanren() {
  return request('http://127.0.0.1:3007/my/chat/chatCatesUser', 'get', '', 1)
}


export {
  userLogin,
  getuser,
  getarticle,
  getzan,
  addzan,
  deletezan,
  getcomments,
  addcomments,
  getreply,
  deletearticle,
  deletecomments,
  addreply,
  deletereply,
  addarticle,
  addreading,
  getuserarticle,
  addarticle1,
  forgetpassword,
  changeuser,
  getallactivity,
  getuseractivity,
  joinactivity,
  getuserlist,
  adminuser,
  user,
  getactivity,
  getaudit,
  adminaudit,
  activityCatesProfessional,
  deleteuser,
  changeactivity,
  deleteactivity,
  addactivity,
  changepassword,
  gethome,
  getothersuser,
  liuyanuser,
  getliuyan,
  getotheractivity,
  getliuyanren
}
